# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer:
pkgname=entropybroker
pkgver=2.9
pkgrel=0
pkgdesc="infrastructure for distributing random numbers (entropy data)"
url="https://www.vanheusden.com/entropybroker/"
arch="x86 x86_64" # problems with libusb on other arches
license="AGPL-3.0"
checkdepends="cppcheck"
depends="ttf-freefont"
makedepends="
	crypto++-dev
	gd-dev
	libexecinfo-dev
	libpng-dev
	libusb-dev
	linux-headers
	pcsc-lite-dev
	zlib-dev
	"
subpackages="$pkgname-doc $pkgname-openrc"
source="entropybroker-$pkgver.tar.gz::https://github.com/flok99/entropybroker/archive/$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd

	make.patch
	missing-include.patch
	use-sched_yield.patch
	musl-link-libexecinfo.patch
	version.patch
	font-path.patch
	"
builddir="$srcdir/entropybroker-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make everything
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname

	install -Dm644 "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="77d3e73b96db485d1051a2da553e29ee4726410e2960918d87aa94132fc941a43bc82aab2b5eb59ea6851871b2d6d53330e26a02eb70764abafdc6a34bd544bb  entropybroker-2.9.tar.gz
8d47f99c8c9980637e0c0946d6aaec104a4a754343bcbf48106b809053654970bdceb30f7cf34f0df3dd6a6f924693833f8faa356298531336a876fbf1d30287  entropybroker.initd
56c80c571abe29b380e11f229391bf69f63aaaddc80e5dc6c3ebaea80e7eba05823d03ca06a258a0374de40b305dcd7735ec3e58e17763796dc3c4151df3dd66  entropybroker.confd
12b9ceaf75d6f7462718e55a13883d01ba054a86692b79b8192e6fb219c948e92f67601a3bb78bffdc80879b0599ba56291e6438125ec90267b95985f264ad12  make.patch
e92cc2e6e8a18dc095d653116fca562e3450796b0b7ff9c769dea0790333ac84b382e921306612b4e4ea5c1e504808e0efe69505c12b135c9add38d8c3e63869  missing-include.patch
1849586b1719fec241ab34955c4e73f67692193db19153ff062e359a1bfab4f9bb1f2a33a5a2103e38f189689f416a61cce40448b6bccc72269eeac89c0354ff  use-sched_yield.patch
7f77a3117af1041b67b76fd09f9bb94954c72216f0187d3a5faa13824a5f906661f4b05bac506edec301bae4349fa02939cc781ec5b47ecfc49f64e52ba31e7d  musl-link-libexecinfo.patch
b29b7261a4547d52bc85215682e84dbd3e91a3422e2fa53d36c6df49deb819e02ddc072648cc4310776b3121f36cea479fde7cb5c148a38651a8dbe8179f89fe  version.patch
08cd42c57baba8a4ebed43926e11fb9f95731c7b1e02833bb7aadaa452feca35892759d06aaa3a43beababe0c856cf504ccd198f82deadfe1e4f0eca1cb0d5ef  font-path.patch"
